package com.example.exception;

import lombok.Getter;

@Getter
public class BizException extends RuntimeException {
    /**
     * 异常对应的错误类型
     */
    private final ErrorType errorType;

    /**
     * 默认是系统异常
     */
    public BizException() {
        this.errorType = SystemErrorType.SYSTEM_ERROR;
    }

    public BizException(ErrorType errorType) {
        this.errorType = errorType;
    }

    public BizException(ErrorType errorType, String message) {
        super(message);
        this.errorType = errorType;
    }

    public BizException(ErrorType errorType, String message, Throwable cause) {
        super(message, cause);
        this.errorType = errorType;
    }
}
